import { AppModel } from '../../../../model/AppModel'
import { createGPIOMenu } from '../BlockPackage'


export default {

    category: Blockly.Categories.control ,
    
    color: [
        Blockly.Colours.event.primary,
        Blockly.Colours.event.secondary,
        Blockly.Colours.event.tertiary
    ] ,

    previousStatement: false ,
    nextStatement: true ,

    eventHandle: true ,

    init(model: AppModel) {
        this.appendDummyInput()
                .appendField("当模型启动时")
    } ,

    run (args: any, util: any, runtime: any) {
        return true
    } ,

    coder: {

        JavaScript(block: any, coder: any) {
            let inner = ''
            let nextBlock = block.nextConnection && block.nextConnection.targetBlock()
            if(nextBlock) {
                inner = "// 当模型启动时"
                // coder.indent ++ 
                inner = coder.blockToCode(nextBlock)
                // coder.indent --
            }

            return inner
        }
    }
}
